Skip to content

chore(zk): update TON verifier export commands#2102

Merged
novusnota merged 6 commits intoton-org:mainfrom
mysteryon88-forks:main
Apr 26, 2026
Merged

chore(zk): update TON verifier export commands#2102
novusnota merged 6 commits intoton-org:mainfrom
mysteryon88-forks:main

Conversation

@mysteryon88
Copy link
Copy Markdown
Contributor

@mysteryon88 mysteryon88 commented Apr 20, 2026

Closes #2124

Summary

Updated the zero-knowledge verifier export documentation to match the latest export-ton-verifier interface.

The utility now uses Tolk as the default target, so the examples were adjusted to export Tolk contracts without an extra flag and to use --func explicitly when generating FunC contracts.

Since Tolk has continued to evolve and the generated verifier now uses newer language features that were not available before, the wrapper flow also had to be updated. The docs now distinguish the wrapper import commands for Tolk and FunC versions so users copy the correct TypeScript wrapper for the contract target they generate.

Changes

  • Updated verifier export examples to make Tolk the default output.
  • Added explicit --func usage for FunC verifier generation.
  • Updated wrapper import commands for Tolk and FunC.
  • Reordered Arkworks and Gnark examples to reflect the current default flow.

Summary by CodeRabbit

  • Documentation
    • Clarified verifier export workflow with an explicit directory navigation step and refined command examples for different contract targets.
    • Rewrote wrapper instructions to describe copying and importing generated wrappers and updated guidance for test imports.
    • Reordered examples to present the new default-first flow and normalized examples across exporters.

@mysteryon88 mysteryon88 requested a review from a team as a code owner April 20, 2026 16:14
@github-actions
Copy link
Copy Markdown
Contributor

Skipping AI review because this PR is from a fork. A maintainer can start the review by commenting /review in this PR.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03c93e5f-eb4b-4b31-bf36-a637d426affc

📥 Commits

Reviewing files that changed from the base of the PR and between fa5b342 and f120356.

📒 Files selected for processing (1)
  • contract-dev/techniques/zero-knowledge.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • contract-dev/techniques/zero-knowledge.mdx

📝 Walkthrough

Walkthrough

Updates zero-knowledge docs to change verifier export commands: add an explicit cd ../.. step, make Tolk the default export target (no --tolk), add --func for FunC and --tact for Tact, and replace manual wrapper generation instructions with explicit copy-and-import examples.

Changes

Cohort / File(s) Summary
Zero-Knowledge Documentation
contract-dev/techniques/zero-knowledge.mdx
Added prerequisite cd ../... Rewrote verifier export examples to treat Tolk as the default (removed --tolk), added --func for FunC and --tact for Tact. Replaced “generated manually” wrapper instructions with copy-based wrapper examples and updated import/test guidance. Normalized Arkworks/gnark blocks and reordered examples.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 I hopped through docs, adjusted each line,
Tolk first by default, FunC and Tact align,
Wrappers copied neat into ./wrappers/,
Tests import tidy — the circuits all cheer! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates a chore task to update TON verifier export commands, directly aligning with the main change in the documentation.
Linked Issues check ✅ Passed Changes align with all objectives from #2124: Tolk set as default, --func required for FunC, wrapper instructions updated for Tolk and FunC, and examples reordered accordingly.
Out of Scope Changes check ✅ Passed All changes are documentation updates to the zero-knowledge verifier export workflow and remain within the scope of #2124.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@contract-dev/zero-knowledge.mdx`:
- Around line 136-145: The code block with the three npx export-ton-verifier
commands runs from the project root but the docs don’t say that; update the
zero-knowledge.mdx snippet containing the npx export-ton-verifier examples to
prepend a brief note like “Run these commands from the project root” and/or add
a single command to change directory to the project root (e.g., cd ../..) so the
relative paths used by the npx export-ton-verifier commands work when followed
sequentially.
- Around line 147-155: The docs currently show running import-wrapper twice into
the same ./wrappers/ directory which will cause the second call to overwrite the
first and break tests that import the Verifier module; update the text to state
that users should run only one import-wrapper command matching their contract
target (use --groth16 for Groth16 or --func for FunC) or direct each command to
a different output directory (e.g., ./wrappers/groth16 and ./wrappers/func) so
both Verifier wrappers can coexist and the test import of Verifier remains
unambiguous.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f9b5c3f-8a92-4006-b63e-a17c87f203b3

📥 Commits

Reviewing files that changed from the base of the PR and between fd9c051 and 8e076f7.

📒 Files selected for processing (1)
  • contract-dev/zero-knowledge.mdx

Comment thread contract-dev/techniques/zero-knowledge.mdx
Comment thread contract-dev/zero-knowledge.mdx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
contract-dev/zero-knowledge.mdx (1)

162-182: ⚠️ Potential issue | 🟡 Minor

Side‑by‑side wrapper paths won't match the test import.

When readers follow the "keep both wrappers side by side" variant (Lines 163–164), the wrapper ends up at ./wrappers/groth16/Verifier.ts or ./wrappers/func/Verifier.ts, but the test snippet at Line 182 still imports from '../wrappers/Verifier'. Users copying both sections verbatim will hit a module-not-found error. Consider either noting that the import path must be adjusted to match the chosen subdirectory (e.g., '../wrappers/groth16/Verifier' or '../wrappers/func/Verifier'), or dropping the side‑by‑side example to keep the single canonical ./wrappers/Verifier.ts path consistent with the test import.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@contract-dev/zero-knowledge.mdx` around lines 162 - 182, The test import in
tests/ZkSimple.spec.ts (import { Verifier } from '../wrappers/Verifier') will
fail if users follow the "keep both wrappers side by side" export commands (npx
export-ton-verifier import-wrapper ./wrappers/groth16/ --groth16 and
./wrappers/func/ --groth16 --func) because those create
./wrappers/groth16/Verifier.ts or ./wrappers/func/Verifier.ts; either update the
test import to reference the correct subfolder (e.g., import { Verifier } from
'../wrappers/groth16/Verifier' or '../wrappers/func/Verifier') or change the
export commands to target the canonical path (./wrappers/Verifier.ts) so the
existing import works unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@contract-dev/zero-knowledge.mdx`:
- Around line 162-182: The test import in tests/ZkSimple.spec.ts (import {
Verifier } from '../wrappers/Verifier') will fail if users follow the "keep both
wrappers side by side" export commands (npx export-ton-verifier import-wrapper
./wrappers/groth16/ --groth16 and ./wrappers/func/ --groth16 --func) because
those create ./wrappers/groth16/Verifier.ts or ./wrappers/func/Verifier.ts;
either update the test import to reference the correct subfolder (e.g., import {
Verifier } from '../wrappers/groth16/Verifier' or '../wrappers/func/Verifier')
or change the export commands to target the canonical path
(./wrappers/Verifier.ts) so the existing import works unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 366a68e1-02c0-40ed-a7c1-74f137f1f139

📥 Commits

Reviewing files that changed from the base of the PR and between 8e076f7 and 9df9cb1.

📒 Files selected for processing (1)
  • contract-dev/zero-knowledge.mdx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
contract-dev/techniques/zero-knowledge.mdx (1)

153-167: Use target-language directory names for side-by-side wrappers.

./wrappers/groth16/ is ambiguous here because both Tolk and FunC wrappers are Groth16 wrappers. Naming the default target directory tolk makes the import guidance match the chosen contract target.

📝 Suggested documentation tweak
 # or keep both wrappers side by side
-npx export-ton-verifier import-wrapper ./wrappers/groth16/ --groth16 --force
+npx export-ton-verifier import-wrapper ./wrappers/tolk/ --groth16 --force
 npx export-ton-verifier import-wrapper ./wrappers/func/ --groth16 --func --force
-These commands copy a TypeScript wrapper file that provides type-safe methods to interact with the verifier contract. If you keep the default `./wrappers/Verifier.ts` path, the test import below works unchanged. If you keep both wrappers side by side, update the import to match the subdirectory you exported to, such as `../wrappers/groth16/Verifier` for Tolk or `../wrappers/func/Verifier` for FunC.
+These commands copy a TypeScript wrapper file that provides type-safe methods to interact with the verifier contract. If you keep the default `./wrappers/Verifier.ts` path, the test import below works unchanged. If you keep both wrappers side by side, update the import to match the subdirectory you exported to, such as `../wrappers/tolk/Verifier` for Tolk or `../wrappers/func/Verifier` for FunC.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@contract-dev/techniques/zero-knowledge.mdx` around lines 153 - 167, The
directory example is ambiguous because both Tolk and FunC produce Groth16
wrappers; update the side-by-side export examples and import guidance to use
explicit target-language directories (e.g., ./wrappers/tolk/ and
./wrappers/func/) so readers can distinguish the Tolk wrapper from the FunC
wrapper; modify the example commands (npx export-ton-verifier import-wrapper
./wrappers/tolk/ --groth16 --force and ./wrappers/func/ --groth16 --func
--force) and the explanatory import paths (../wrappers/tolk/Verifier and
../wrappers/func/Verifier) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@contract-dev/techniques/zero-knowledge.mdx`:
- Around line 153-167: The directory example is ambiguous because both Tolk and
FunC produce Groth16 wrappers; update the side-by-side export examples and
import guidance to use explicit target-language directories (e.g.,
./wrappers/tolk/ and ./wrappers/func/) so readers can distinguish the Tolk
wrapper from the FunC wrapper; modify the example commands (npx
export-ton-verifier import-wrapper ./wrappers/tolk/ --groth16 --force and
./wrappers/func/ --groth16 --func --force) and the explanatory import paths
(../wrappers/tolk/Verifier and ../wrappers/func/Verifier) accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 902366ad-a07d-42ce-8801-e0f400a4ef32

📥 Commits

Reviewing files that changed from the base of the PR and between 9df9cb1 and fa5b342.

📒 Files selected for processing (1)
  • contract-dev/techniques/zero-knowledge.mdx

@novusnota novusnota changed the title docs: update TON verifier export commands chore(zk): update TON verifier export commands Apr 23, 2026
Copy link
Copy Markdown
Collaborator

@novusnota novusnota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mysteryon88 Thanks for the update!

@kay-is, I'll merge this one first so your PR (#2128) can adjust accordingly. Otherwise, merging yours first would cause too many conflicts here. Sorry for the slight inconvenience on your end :)

@novusnota novusnota merged commit 79e16e2 into ton-org:main Apr 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contract dev > Techniques > ZK] Update export commands

2 participants